package com.server.http.handler.impl;

import com.server.conditionenum.HttpReturnStatus;
import com.server.db.DataBaseManager;
import com.server.http.handler.HttpHandler;
import com.server.http.request.HttpRequestMessage;
import com.server.http.response.HttpResponseMessage;
import com.server.mine.net.HttpProtocol;

public class Client_LoginFromUname extends HttpHandler{
	@Override
	public void handle(HttpRequestMessage request, HttpResponseMessage response) {
		String username = request.getParameter("uname");
		String password = request.getParameter("pword");
		long uid = 0;
		if(username == null || username.equals("") || password == null || password.equals("")) {
			uid = -1;
		}else {
			uid = DataBaseManager.GetInstance().LoginFromUsername(username, password);
		}
		

		SetReturnData(response,uid,HttpProtocol.USERLOGIN,HttpReturnStatus.Successed);
	}
}
